local GameIcon = class("GameIcon", function()
  return ccui.Widget:create()
end)

GameIcon.m_data = nil

function GameIcon:create()
  local node = GameIcon.new()
  return node
end

function GameIcon:ctor()
    SpriteFrameMgr:getInstance():addSpriteFrameFile("ui/launcher/gamepic0.plist")
end

function GameIcon:setHander(hander)
  self.m_hWndList = hander
end

function GameIcon:setItemData(data)
  local imgPath = "ui/gamepic/Game_"..data.nGameId..".png"
  self.m_data = data

  self.m_btnGameIcon = ccui.Button:create(imgPath, imgPath, imgPath, ccui.TextureResType.plistType)
  self.m_btnGameIcon:setLocalZOrder(0)
  self:setContentSize(self.m_btnGameIcon:getContentSize())
  self.m_btnGameIcon:setAnchorPoint(0.5, 0.5)
  self.m_btnGameIcon:setPositionX(self.m_btnGameIcon:getContentSize().width)
  self.m_btnGameIcon:setPositionY(self.m_btnGameIcon:getContentSize().height)
  self.m_btnGameIcon:setTouchEnabled(true)
  self:addChild(self.m_btnGameIcon)
  self.m_btnGameIcon:addTouchEventListener(function(sender, eventType) self:onMenutClick(sender, eventType)  end)
 
end

function GameIcon:onMenutClick(sender,eventType)
    if eventType == ccui.TouchEventType.ended then
        if sender == self.m_btnGameIcon then     
            print ("=========GameIcon:onMenutClick======szAndrDownAddr================="..self.m_data.szAndrDownAddr)
 
        end
    end
end

return GameIcon
